package com.winshare.saleAssistant.service.impl;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.winshare.saleAssistant.dao.SaleMapper;
import com.winshare.saleAssistant.domain.dto.req.DataAnalysisQueryDTO;
import com.winshare.saleAssistant.domain.dto.req.UserQueryDTO;
import com.winshare.saleAssistant.model.Sale;
import com.winshare.saleAssistant.service.ISaleService;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 销售数据 服务实现类
 * </p>
 *
 * @author stylefeng
 * @since 2020-11-11
 */
@Service
public class SaleServiceImpl extends ServiceImpl<SaleMapper, Sale> implements ISaleService {

    @Override
    public List<Sale> selectList1() {
        return this.baseMapper.selectList1();
    }

    @Override
    public com.winshare.saleAssistant.util.Page<Sale> selectSaleByCondition(UserQueryDTO userQueryDTO) {
        int totalCount = this.baseMapper.querySaleCount(userQueryDTO);
        Integer pageIndex = userQueryDTO.getPageIndex();
        Integer pageSize = userQueryDTO.getPageSize();
        if (0 == totalCount) {
            return new com.winshare.saleAssistant.util.Page<>(pageIndex, pageSize, totalCount, new ArrayList<>());
        } else {
            return new com.winshare.saleAssistant.util.Page<>(pageIndex, pageSize, totalCount, this.baseMapper.selectSaleByCondition(userQueryDTO));
        }
    }

    @Override
    public String getSell(Date starTime, Date endTime, String productName) {
        return this.baseMapper.getSell(starTime, endTime, productName);
    }


    @Override
    public Integer getPSellCount(Date starTime, Date endTime, String productName) {
        return this.baseMapper.getPSellCount(starTime, endTime, productName);
    }

    @Override
    public List<Map<String, Object>> getSaleTotal(String sjType) {
        return this.baseMapper.getSaleTotal(sjType);
    }

    @Override
    public List<Map<String, Object>> getSaleProduct(Date starTime, Date endTime) {
        return this.baseMapper.getSaleProduct(starTime, endTime);
    }

    @Override
    public List<Map<String, Object>> getSaleArea(Date starTime, Date endTime) {
        return this.baseMapper.getSaleArea(starTime, endTime);
    }

    @Override
    public List<Sale> getSales(Date starTime, Date endTime, String productName) {
        return this.baseMapper.getSales(starTime, endTime, productName);
    }

    @Override
    public List<Sale> getLuxuryTotalMoney(String productName, Date starTime, Date endTime) {
        return this.baseMapper.getLuxuryTotalMoney(productName, starTime, endTime);
    }

    @Override
    public List<Sale> getTrialTotalMoney(String productName, Date starTime, Date endTime) {
        return this.baseMapper.getTrialTotalMoney(productName, starTime, endTime);
    }

    @Override
    public List<Sale> getBasisTotalMoney(String productName, Date starTime, Date endTime) {
        return this.baseMapper.getBasisTotalMoney(productName, starTime, endTime);
    }

    @Override
    public List<Sale> getrankingTotal(String areaName, String parentAreaName, String cityName, String productName, Date starTime, Date endTime) {
        return this.baseMapper.getrankingTotal(areaName, parentAreaName, cityName, productName, starTime, endTime);
    }

    @Override
    public List<Sale> getrankingMoney(String areaName, String parentAreaName, String cityName, String productName, Date starTime, Date endTime) {
        return this.baseMapper.getrankingMoney(areaName, parentAreaName, cityName, productName, starTime, endTime);
    }

    @Override
    public List<Map<String, Object>> getAreaSaleRanking(DataAnalysisQueryDTO dataAnalysisQueryDTO) {
        return this.baseMapper.getAreaSaleRanking(dataAnalysisQueryDTO);
    }

    @Override
    public Integer getProductTotal(String parentAreaName, String productName, Date starTime, Date endTime) {
        return this.baseMapper.getProductTotal(parentAreaName, productName, starTime, endTime);
    }

    @Override
    public Integer getTeacherTotal(String parentAreaName, String productName, Date starTime, Date endTime) {
        return this.baseMapper.getTeacherTotal(parentAreaName, productName, starTime, endTime);
    }

    @Override
    public Integer getStudentTotal(String parentAreaName, String productName, Date starTime, Date endTime) {
        return this.baseMapper.getStudentTotal(parentAreaName, productName, starTime, endTime);
    }

    @Override
    public Integer getSchoolTotal() {
        return this.baseMapper.getSchoolTotal();
    }

    @Override
    public Integer getCitySchoolTotal(String cityName) {
        return this.baseMapper.getCitySchoolTotal(cityName);
    }

    @Override
    public List<Sale> getRateOfCoverage(String parentAreaName, String productName, Date starTime, Date endTime) {
        return this.baseMapper.getRateOfCoverage(parentAreaName, productName, starTime, endTime);
    }

    @Override
    public List<Sale> getLoginTotal(String parentAreaName, String productName, Date starTime, Date endTime) {
        return this.baseMapper.getLoginTotal(parentAreaName, productName, starTime, endTime);
    }

    @Override
    public List<Sale> getLogin(String parentAreaName, String productName, Date starTime, Date endTime) {
        return this.baseMapper.getLogin(parentAreaName, productName, starTime, endTime);
    }

    @Override
    public List<Sale> getProductEmploy(String parentAreaName, String productName, Date starTime, Date endTime) {
        return this.baseMapper.getProductEmploy(parentAreaName, productName, starTime, endTime);
    }

    @Override
    public List<Map<String, Object>> getExportSale(Page<Map<String, Object>> page) {
        return this.baseMapper.getExportSale(page);
    }

    @Override
    public List<Map<String, Object>> getSaleTotalWeek(Integer product_id) {
        return this.baseMapper.getSaleTotalWeek(product_id);
    }

    @Override
    public List<Map<String, Object>> getSaleTotalMonth(Integer product_id) {
        return this.baseMapper.getSaleTotalMonth(product_id);
    }

    @Override
    public List<Map<String, Object>> getLoginTotalWeek(Integer product_id) {
        return this.baseMapper.getLoginTotalWeek(product_id);
    }

    @Override
    public List<Map<String, Object>> getLoginTotalMonth(Integer product_id) {
        return this.baseMapper.getLoginTotalMonth(product_id);
    }

    @Override
    public List<Map<String, Object>> getLoginTotalYear(Integer product_id) {
        return this.baseMapper.getLoginTotalYear(product_id);
    }

    @Override
    public List<Map<String, Object>> getSaleTotalYear(Integer product_id) {
        return this.baseMapper.getSaleTotalYear(product_id);
    }

    @Override
    public List<Map<String, Object>> getExportList(String areaName) {
        return this.baseMapper.getExportList(areaName);
    }

    @Override
    public void deleteBySchoolCode(String schoolCode) {
        this.baseMapper.deleteBySchoolCode(schoolCode);
    }

    @Override
    public void deleteByUuid(String id) {
        this.baseMapper.deleteByUuid(id);
    }

    @Override
    public Map<String, Object> getRegionalSituation(String productName, Date starTime, Date endTime) {
        return this.baseMapper.getRegionalSituation(productName, starTime, endTime);
    }

    @Override
    public List<Map<String, Object>> getLoginTime(String productName, Date starTime, Date endTime) {
        return this.baseMapper.getLoginTime(productName, starTime, endTime);
    }

    @Override
    public List<Map<String, Object>> getSchoolUseList(String orderBy, String areaName, String productName, Date starTime, Date endTime) {
        return this.baseMapper.getSchoolUseList(orderBy, areaName, productName, starTime, endTime);
    }

    @Override
    public List<Map<String, Object>> getUserUseList(String orderBy, String areaName, String productName, Date starTime, Date endTime) {
        return this.baseMapper.getUserUseList(orderBy, areaName, productName, starTime, endTime);
    }

    @Override
    public List<Map<String, Object>> getFunUseList(String orderBy, String areaName, String productName, Date starTime, Date endTime) {
        return this.baseMapper.getFunUseList(orderBy, areaName, productName, starTime, endTime);
    }

    @Override
    public List<Map<String, Object>> getSaleCMStatistical(String productName, Date starTime, Date endTime) {
        return this.baseMapper.getSaleCMStatistical(productName, starTime, endTime);
    }

    @Override
    public List<Map<String, Object>> getUserSchoolUseList(Integer schoolId) {
        return this.baseMapper.getUserSchoolUseList(schoolId);
    }
}
